import requests
import subprocess
from functools import partial
subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")
import execjs



with open("参数加密.js","r",encoding="utf-8")as f:
    data = f.read()

js = execjs.compile(data)
hxh = js.call("result")

with open("返回值解密.js","r",encoding="utf-8")as f:
    data = f.read()

js = execjs.compile(data)

headers = {
    "Accept": "*/*",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Connection": "keep-alive",
    "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
    "Origin": "https://www.aqistudy.cn",
    "Referer": "https://www.aqistudy.cn/html/city_map.php?v=1.6",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-origin",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "X-Requested-With": "XMLHttpRequest",
    "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\""
}
cookies = {
    "Hm_lvt_6088e7f72f5a363447d4bafe03026db8": "1703569905",
    "Hm_lpvt_6088e7f72f5a363447d4bafe03026db8": "1703569905"
}
url = "https://www.aqistudy.cn/apinew/aqistudyapi.php"
data = {
    "hXhY1B2Kd": hxh
}
response = requests.post(url, headers=headers, cookies=cookies, data=data)

decry = js.call("deIZLF7oahc0DLiXbqt",response.text)
print(decry)